#ifndef CARSOLOMESHBUILDER_H
#define CARSOLOMESHBUILDER_H

#include "Recast.h"
#include "CarBuildConfig.h"

class CarSoloMeshBuilder
{
public:
	static CarSoloMeshBuilder instance;

	CarSoloMeshBuilder();
	virtual ~CarSoloMeshBuilder();
	void SetBuildConfig(CarBuildConfig* carBuildConfig);
	CarBuildConfig* GetBuildConfig();
	void SetMeshData(float* vertexBuffer, int vertexCount, int* triangleBuffer, int triangleCount);
	bool Build();
	void Cleanup();

private:
	CarBuildConfig* mCarBuildConfig = nullptr;
	rcConfig mConfig;
	rcContext mContext;
	bool mKeepInternalResults = false;
	unsigned char* mTriangleAreas = nullptr;
	rcHeightfield* mHeightfield = nullptr;
	rcCompactHeightfield* mCompactHeightfield = nullptr;
	rcContourSet* mContourSet = nullptr;
	rcPolyMesh* mPolyMesh = nullptr;
	rcPolyMeshDetail* mPolyMeshDetail = nullptr;
	class dtNavMesh* mNavMesh = nullptr;
	class dtNavMeshQuery* mNavMeshQuery = nullptr;
};

#endif // CARSOLOMESHBUILDER_H
